import numpy as np
interest_score = np.random.randint(10, size=(4, 3))
print(interest_score)

sum_val_1 = np.sum(interest_score, axis=0)
print(sum_val_1)

sum_val_2 = np.sum(interest_score, axis=1)
print(sum_val_2)

avg = np.average(interest_score, axis=1)
print(avg)
# 不过np.average还可以用于加权平均,
# 比如给定每个游戏的权值weights=np.array([4,2,7]),
# 计算每名同学对三款游戏的加权平均就可以这样做
weights=np.array([4,2,7])
weight_avg = np.average(interest_score, weights=weights, axis=1)
print(weight_avg)






